{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "define gym environment for RL"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import multiprocessing\n",
    "import numpy as np\n",
    "import pickle\n",
    "import time\n",
    "from models import GridModel\n",
    "from common import find_grid_idx, extract_time_feat, min_gps, max_gps, real_distance, block_number, cuda\n",
    "delta_gps = max_gps - min_gps"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GridModel(\n",
       "  (houremb): Embedding(24, 8)\n",
       "  (order): Sequential(\n",
       "    (0): Linear(in_features=10, out_features=32, bias=True)\n",
       "    (1): ReLU()\n",
       "    (2): Linear(in_features=32, out_features=1, bias=True)\n",
       "  )\n",
       "  (reward): Sequential(\n",
       "    (0): Linear(in_features=10, out_features=32, bias=True)\n",
       "    (1): ReLU()\n",
       "    (2): Linear(in_features=32, out_features=1, bias=True)\n",
       "  )\n",
       ")"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model = GridModel()\n",
    "model.load_state_dict(torch.load('data/model/grid/best.pt')['model'])\n",
    "model.eval()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "pkl_folder = 'data/pkl/'\n",
    "rd_data = pickle.load(open(pkl_folder + 'grid_order_reward.pkl', 'rb'))\n",
    "meanstd = {'order': [1.3818544802263453, 2.0466071372530115], 'reward': [0.003739948797879627, 0.000964668315987685]}\n",
    "for i in meanstd.keys():\n",
    "    n = meanstd[i]\n",
    "    if i == 'order':\n",
    "        rd_data[i] = np.log(rd_data[i] + 1)\n",
    "    r = rd_data[i]\n",
    "    r -= n[0]\n",
    "    r /= n[1]\n",
    "rd_data = np.concatenate([np.expand_dims(rd_data['reward'],2), np.expand_dims(rd_data['order'],2)], axis=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "action_data = pickle.load(open(pkl_folder + 'carenv_actions.pkl', 'rb'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "class CarEnv:\n",
    "    \"\"\"KDDCup2020 car environment\n",
    "    State: [lat, lon, hour, average_reward, demand]\n",
    "    Action: [lat, lon, ETA, reward, prob]\n",
    "    \n",
    "    Args:\n",
    "        actions: (block_number, 24) list, every item contains actions\n",
    "                 [startlat, startlon, endlat, endlon, ETA, reward, prob] with shape (x,) except prob \n",
    "                 with shape (x,10)\n",
    "        reward_demand: shape (block_number, 2), means average reward and average demand    TODO: use NN to predict?\n",
    "        random_seed: initial seed\n",
    "        choose_ratio: select how much actions\n",
    "        choose_max: select as maximum how much actions\n",
    "    \"\"\"\n",
    "    \n",
    "    def __init__(self, actions, reward_demand, random_seed = None, choose_ratio = 0.6, choose_max = 12):\n",
    "        self.actions = actions\n",
    "        self.reward_demand = reward_demand\n",
    "        if random_seed == None:\n",
    "            random_seed = np.random.randint(1 << 31)\n",
    "        self.rng = np.random.RandomState(random_seed)\n",
    "        self.now_time = None\n",
    "        self.now_state = None\n",
    "        self.now_actions = None\n",
    "        self.choose_ratio = choose_ratio\n",
    "        self.choose_max = choose_max\n",
    "        self.fail_waste = 600.0\n",
    "        self.is_reset = False\n",
    "        #self.reset()\n",
    "        \n",
    "    def _get_reward_demand(self, s):\n",
    "        if s[0] < 0 or s[1] < 0 or s[0] >= 1 or s[1] >= 1:\n",
    "            return np.array([0, 0])\n",
    "        return self.reward_demand[int(s[0] * block_number[0]) * block_number[1] + int(s[1] * block_number[1]), s[2]]\n",
    "        \n",
    "    def _select_action(self):\n",
    "        default_action = [np.array([self.now_state[0]]), np.array([self.now_state[1]]), \n",
    "                          np.array([self.now_state[0]]), np.array([self.now_state[1]]), \n",
    "                          np.array([0]), np.array([0]), np.array([1.0])]\n",
    "        pos = (block_number * self.now_state[:2]).astype(int)\n",
    "        expand = 1\n",
    "        t_expand = 1\n",
    "        alla = []\n",
    "        for i in range(-expand, expand + 1):\n",
    "            for j in range(-expand, expand + 1):\n",
    "                for k in range(-t_expand, t_expand + 1):\n",
    "                    k = (k + self.now_state[2] + 24) % 24\n",
    "                    nowp = [i, j] + pos\n",
    "                    if (nowp < 0).any() or (nowp >= block_number).any():\n",
    "                        continue\n",
    "                    block_idx = (nowp * [block_number[1], 1]).sum()\n",
    "                    #print(block_idx, k)\n",
    "                    if len(self.actions[block_idx][k][0]) > 0:\n",
    "                        alla.append(self.actions[block_idx][k])\n",
    "        alla = [np.concatenate(x) for x in zip(*alla)]\n",
    "        if len(alla) == 0:\n",
    "            return default_action\n",
    "        choose_num = int(self.rng.normal(self.choose_ratio, 2) * len(alla[0]))\n",
    "        if choose_num <= 0:\n",
    "            choose_num = 1\n",
    "        if choose_num > len(alla[0]):\n",
    "            choose_num = len(alla[0])\n",
    "        if choose_num >= self.choose_max:\n",
    "            choose_num = self.choose_max - 1\n",
    "        choose = self.rng.choice(len(alla[0]), choose_num, replace = False)\n",
    "        alla = [x[choose] for x in alla]\n",
    "        gps = np.stack(alla[:2]).transpose(1, 0)\n",
    "        gps = (gps - self.now_state[:2]) * real_distance\n",
    "        gps = (gps ** 2).sum(axis=1) ** 0.5\n",
    "        alla[4] += (gps / 5.7).astype(int) # add time driving to there\n",
    "        gps = (gps / 200).astype(int)\n",
    "        gps[gps > 9] = 9\n",
    "        alla[-1] = np.choose(gps, alla[-1].T)\n",
    "        #print(gps, alla[-1])\n",
    "        for i in range(len(alla)):\n",
    "            alla[i] = np.append(alla[i], default_action[i])\n",
    "        return alla\n",
    "    \n",
    "    def _model_grid(self, args):\n",
    "        with torch.no_grad():\n",
    "            res = model(torch.tensor([args[:2]]), torch.tensor([args[2]]))\n",
    "            #print(args, res)\n",
    "            return res[1].item()\n",
    "    \n",
    "    def reset(self):\n",
    "        while True:\n",
    "            self.now_time = self.rng.randint(86400)\n",
    "            s = [*self.rng.random(2), self.now_time // 3600]\n",
    "            s += self._get_reward_demand(s).tolist()\n",
    "            s[-1] = self._model_grid(s[:3])\n",
    "            self.now_state = s\n",
    "            a = self._select_action()\n",
    "            if len(a) == 1:\n",
    "                continue\n",
    "            self.now_actions = a\n",
    "            break\n",
    "        self.is_reset = True\n",
    "        return self.now_state, {'time': self.now_time}\n",
    "    \n",
    "    def step(self, action):\n",
    "        assert(self.is_reset)\n",
    "        a = [x[action] for x in self.now_actions][2:]\n",
    "        if self.rng.random() < a[4]:\n",
    "            reward = 0\n",
    "            length = self.fail_waste # waste some time\n",
    "            self.now_time = int(self.now_time + length) % 86400\n",
    "            self.now_state = [*self.now_state[:2], self.now_time // 3600]\n",
    "            s = self.now_state\n",
    "            s += self._get_reward_demand(s).tolist()\n",
    "            s[-1] = self._model_grid(s[:3])\n",
    "            self.now_actions = self._select_action()\n",
    "            return s, reward, length, {'time': self.now_time}\n",
    "        reward = a[3]\n",
    "        length = a[2]\n",
    "        self.now_time = int(self.now_time + length) % 86400\n",
    "        self.now_state = [*a[:2], self.now_time // 3600]\n",
    "        s = self.now_state\n",
    "        s += self._get_reward_demand(s).tolist()\n",
    "        s[-1] = self._model_grid(s[:3])\n",
    "        self.now_actions = self._select_action()\n",
    "        return s, reward, length, {'time': self.now_time}\n",
    "    def get_actions(self):\n",
    "        assert(self.is_reset)\n",
    "        return self.now_actions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "class EnvWorker(multiprocessing.Process):\n",
    "    def __init__(self, env, envargs, pipe1, pipe2):\n",
    "        multiprocessing.Process.__init__(self, daemon = True)\n",
    "        self.env = env(*envargs)\n",
    "        self.pipe = pipe1\n",
    "        self.pipe2 = pipe2\n",
    "    \n",
    "    def run(self):\n",
    "        self.pipe2.close()\n",
    "        while True:\n",
    "            try:\n",
    "                cmd, data = self.pipe.recv()\n",
    "                if cmd == 'step':\n",
    "                    self.pipe.send(self.env.step(data))\n",
    "                elif cmd == 'get_actions':\n",
    "                    self.pipe.send(self.env.get_actions())\n",
    "                elif cmd == 'close':\n",
    "                    self.pipe.close()\n",
    "                    break\n",
    "                elif cmd == 'reset':\n",
    "                    self.pipe.send(self.env.reset())\n",
    "                else:\n",
    "                    raise NotImplementedError\n",
    "            except EOFError:\n",
    "                break\n",
    "                \n",
    "class EnvVecs:\n",
    "    def __init__(self, env_class, n_envs, env_args, arg_seed_pos = -1, seed = 0):\n",
    "        self.waiting = False\n",
    "        self.closed = False\n",
    "\n",
    "        self.remotes, self.work_remotes = zip(*[multiprocessing.Pipe(duplex=True) for _ in range(n_envs)])\n",
    "        self.processes = []\n",
    "        for work_remote, remote in zip(self.work_remotes, self.remotes):\n",
    "            #args = (env_class, work_remote, remote)\n",
    "            # daemon=True: if the main process crashes, we should not cause things to hang\n",
    "            args = list(env_args)\n",
    "            if arg_seed_pos != -1:\n",
    "                args[arg_seed_pos] = seed\n",
    "                seed += 1\n",
    "            process = EnvWorker(env_class, args, work_remote, remote)  # pytype:disable=attribute-error\n",
    "            process.start()\n",
    "            self.processes.append(process)\n",
    "            work_remote.close()\n",
    "        self.is_reset = False\n",
    "\n",
    "    def step_async(self, actions):\n",
    "        for remote, action in zip(self.remotes, actions):\n",
    "            remote.send(('step', action))\n",
    "        self.waiting = True\n",
    "\n",
    "    def step_wait(self):\n",
    "        results = [remote.recv() for remote in self.remotes]\n",
    "        self.waiting = False\n",
    "        obs, rews, lengths, infos = zip(*results)\n",
    "        self._get_actions()\n",
    "        return self._flatten_obs(obs), np.stack(rews), np.stack(lengths), self._flatten_info(infos)\n",
    "\n",
    "    def step(self, actions):\n",
    "        assert(self.is_reset)\n",
    "        self.step_async(actions)\n",
    "        return self.step_wait()\n",
    "    \n",
    "    def close(self):\n",
    "        if self.closed:\n",
    "            return\n",
    "        if self.waiting:\n",
    "            for remote in self.remotes:\n",
    "                remote.recv()\n",
    "        for remote in self.remotes:\n",
    "            remote.send(('close', None))\n",
    "        for process in self.processes:\n",
    "            process.join()\n",
    "        self.closed = True\n",
    "    \n",
    "    def _get_actions(self):\n",
    "        for remote in self.remotes:\n",
    "            remote.send(('get_actions', None))\n",
    "        self.actions = [remote.recv() for remote in self.remotes]\n",
    "\n",
    "    def get_actions(self):\n",
    "        assert(self.is_reset)\n",
    "        return self.actions\n",
    "        \n",
    "    def reset(self):\n",
    "        for remote in self.remotes:\n",
    "            remote.send(('reset', None))\n",
    "        results = [remote.recv() for remote in self.remotes]\n",
    "        obs, infos = zip(*results)\n",
    "        self.is_reset = True\n",
    "        self._get_actions()\n",
    "        return self._flatten_obs(obs), self._flatten_info(infos)\n",
    "    \n",
    "    def _flatten_obs(self, obs):\n",
    "        #print(obs)\n",
    "        obs = list(zip(*obs))\n",
    "        obs = list(map(lambda x:np.stack(x), obs))\n",
    "        #print(obs)\n",
    "        return obs\n",
    "    \n",
    "    def _flatten_info(self, info):\n",
    "        if len(info) == 0:\n",
    "            return {}\n",
    "        res = {}\n",
    "        for key in info[0].keys():\n",
    "            res[key] = np.stack([x[key] for x in info])\n",
    "        return res\n",
    "    \n",
    "    def __del__(self):\n",
    "        self.close()\n",
    "\n",
    "def get_carenvvec(number, seed = None):\n",
    "    if seed == None:\n",
    "        return EnvVecs(CarEnv, number, (action_data, rd_data))\n",
    "    return EnvVecs(CarEnv, number, (action_data, rd_data, 0), 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "13165 [[[0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  ...\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]]\n",
      "\n",
      " [[0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  ...\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]]\n",
      "\n",
      " [[0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  ...\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]]\n",
      "\n",
      " ...\n",
      "\n",
      " [[0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  ...\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.01322304 0.01322304 0.        ]]\n",
      "\n",
      " [[0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  ...\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.01322304 0.01322304 0.        ]]\n",
      "\n",
      " [[0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  ...\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.         0.         0.        ]\n",
      "  [0.         0.         0.         ... 0.01322304 0.01322304 0.        ]]]\n"
     ]
    }
   ],
   "source": [
    "rd = pickle.load(open(pkl_folder + 'grid_order_reward.pkl', 'rb'))\n",
    "rr = rd['reward'].reshape(50, 50, 24)\n",
    "sz = 5\n",
    "tsz = 5\n",
    "rr = np.concatenate((rr, rr[:,:,:tsz]),axis=2)\n",
    "res = np.zeros((rr.shape))\n",
    "for i in range(sz):\n",
    "    for j in range(sz):\n",
    "        for k in range(tsz):\n",
    "            #print(i,j)\n",
    "            res[:50 - i,:50 - j, :24 + tsz - k] += rr[i:,j:,k:]\n",
    "res = res[:-sz,:-sz,:-tsz]\n",
    "print((res == 0).sum(), res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "ce = CarEnv(action_data, rd_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "([0.5283012630239232, 0.5788719042144252, 0, 1.1966354227041558, 6.207372665405273], {'time': 3584})\n",
      "[array([0.54627   , 0.52830126]), array([0.54280444, 0.5788719 ]), array([0.31004   , 0.52830126]), array([0.27686667, 0.5788719 ]), array([2174,    0]), array([14.26,  0.  ]), array([0.054157, 1.      ])]\n",
      "([0.31004000000001497, 0.27686666666667004, 1, 2.8977822389235333, 2.783015727996826], 14.26, 2174, {'time': 5758})\n"
     ]
    }
   ],
   "source": [
    "print(ce.reset())\n",
    "print(ce.get_actions())\n",
    "print(ce.step(0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[array([0.314462, 0.3189  , 0.312988, 0.317224, 0.311666, 0.314154,\n",
      "       0.312664, 0.318602, 0.31423 , 0.312988, 0.32064 , 0.31004 ]), array([0.28870667, 0.28519778, 0.26415778, 0.28382667, 0.26392   ,\n",
      "       0.24642667, 0.26364444, 0.28578667, 0.27022667, 0.26415778,\n",
      "       0.28406444, 0.27686667]), array([0.53502 , 0.513456, 0.70576 , 0.51946 , 0.4973  , 0.55896 ,\n",
      "       0.5644  , 0.52308 , 0.57596 , 0.61112 , 0.51238 , 0.31004 ]), array([0.48346667, 0.49624889, 0.51355556, 0.54691111, 0.51877778,\n",
      "       0.4608    , 0.46444444, 0.5068    , 0.53071111, 0.58376   ,\n",
      "       0.46942222, 0.27686667]), array([1582, 1394, 2074, 1763, 1972, 1925, 1742, 2156, 2222, 2296, 1443,\n",
      "          0]), array([ 9.7 , 10.73, 16.23, 11.9 , 13.3 , 10.4 , 10.62, 12.01, 14.35,\n",
      "       16.7 , 10.2 ,  0.  ]), array([0.040703, 0.048611, 0.158374, 0.290067, 0.202006, 0.0733  ,\n",
      "       0.049986, 0.056614, 0.167448, 0.274834, 0.033624, 1.      ])]\n",
      "([0.5350200000000029, 0.4834666666666728, 2, 1.0461142671361017, 5.741932392120361], 9.7, 1582, {'time': 7340})\n"
     ]
    }
   ],
   "source": [
    "print(ce.get_actions())\n",
    "print(ce.step(0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "ev = get_carenvvec(40)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "([array([0.05116192, 0.31046204, 0.720888  , 0.80825595, 0.41579263,\n",
      "       0.22452482, 0.82790867, 0.53288102, 0.97993803, 0.25922624,\n",
      "       0.62198563, 0.35614321, 0.03615812, 0.73729586, 0.13965611,\n",
      "       0.05677904, 0.20344274, 0.88991362, 0.91117747, 0.95209474,\n",
      "       0.67061634, 0.8647112 , 0.18038643, 0.52240924, 0.82116881,\n",
      "       0.35957872, 0.65971114, 0.01592468, 0.69477805, 0.56920922,\n",
      "       0.43823464, 0.1094505 , 0.27685393, 0.87845169, 0.15847334,\n",
      "       0.51651749, 0.5635747 , 0.39904473, 0.98705714, 0.17779077]), array([0.36597161, 0.19490209, 0.71308395, 0.04424366, 0.04212024,\n",
      "       0.39829165, 0.9371378 , 0.40247466, 0.40263977, 0.81452487,\n",
      "       0.29475595, 0.94947447, 0.78772761, 0.10317523, 0.926348  ,\n",
      "       0.20082402, 0.77654082, 0.86754822, 0.22571368, 0.78056141,\n",
      "       0.49405879, 0.43107837, 0.39251091, 0.97919694, 0.34638098,\n",
      "       0.88854528, 0.45570949, 0.16184251, 0.244878  , 0.47286445,\n",
      "       0.04623107, 0.05156903, 0.06153155, 0.6899816 , 0.75099091,\n",
      "       0.57898846, 0.1029399 , 0.72611157, 0.52550716, 0.54411763]), array([12,  4, 20,  6,  7,  5, 15, 21,  2,  2, 15,  3, 17, 17, 15,  4, 18,\n",
      "       12,  6,  5, 16, 19, 14,  9,  5, 21,  8,  6, 20,  1,  6,  5,  3, 19,\n",
      "        4, 14,  2,  7, 12,  0]), array([-3.87692716, -3.87692716, -3.87692716, -3.87692716, -3.87692716,\n",
      "       -3.87692716, -3.87692716, -0.91074042, -3.87692716, -3.87692716,\n",
      "       -3.87692716, -3.87692716, -3.87692716, -3.87692716, -3.87692716,\n",
      "       -3.87692716, -0.26032254, -3.87692716, -3.87692716, -3.87692716,\n",
      "       -0.99155191, -0.39413229, -3.87692716, -3.87692716, -3.87692716,\n",
      "       -3.87692716, -0.52945128, -3.87692716, -3.87692716,  1.13095564,\n",
      "       -3.87692716, -3.87692716, -3.87692716, -3.87692716, -3.87692716,\n",
      "       -0.89460493, -3.87692716, -3.87692716, -3.87692716, -3.87692716]), array([ 0.30465788,  2.38392735,  5.66504526,  4.69930887,  0.5339064 ,\n",
      "        3.20712399,  7.9619379 ,  2.44789624,  8.61781025,  6.21824551,\n",
      "        2.20998335,  7.72957039,  2.00262976,  2.14129043,  3.20204806,\n",
      "        2.34368968,  2.17178583,  8.41040802,  6.55344343, 11.44190025,\n",
      "        3.17602777,  4.22459555,  0.04772596,  5.37143135,  6.56425095,\n",
      "        5.74004602,  3.43749261,  1.41751325,  2.53454351,  5.94949913,\n",
      "        1.78310287,  2.17207432,  1.88536119,  5.83153582,  4.29991055,\n",
      "        2.31995749,  3.54821444,  2.8450675 ,  6.49429941,  3.81642032])], {'time': array([45671, 15380, 72089, 24012, 28009, 19507, 55934, 79029, 10229,\n",
      "        9667, 55876, 11853, 61467, 63872, 55646, 16691, 67920, 44053,\n",
      "       23777, 20832, 59953, 71669, 52748, 32552, 20271, 77300, 28971,\n",
      "       23991, 75143,  7011, 22787, 20593, 13041, 69337, 15547, 51329,\n",
      "        7861, 26061, 45232,   951])})\n"
     ]
    }
   ],
   "source": [
    "print(ev.reset())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[array([0.061942  , 0.05116192]), array([0.34544444, 0.36597161]), array([0.36524   , 0.05116192]), array([0.33351111, 0.36597161]), array([3960,    0]), array([9.85, 0.  ]), array([0.032217, 1.      ])], [array([0.33836   , 0.31046204]), array([0.18048889, 0.19490209]), array([0.55816   , 0.31046204]), array([0.53824444, 0.19490209]), array([3272,    0]), array([17.55,  0.  ]), array([0.047289, 1.      ])], [array([0.74934 , 0.74534 , 0.73946 , 0.736956, 0.74434 , 0.75428 ,\n",
      "       0.72028 , 0.74156 , 0.7397  , 0.70372 , 0.710592, 0.720888]), array([0.73644444, 0.7134    , 0.71875556, 0.71020444, 0.73477778,\n",
      "       0.71337778, 0.73955556, 0.73106667, 0.69626667, 0.73335556,\n",
      "       0.6812    , 0.71308395]), array([0.53876 , 0.6347  , 0.61816 , 0.596506, 0.65054 , 0.5644  ,\n",
      "       0.62548 , 0.60128 , 0.45926 , 0.63248 , 0.61602 , 0.720888]), array([0.45031111, 0.55706667, 0.49986667, 0.48346222, 0.4982    ,\n",
      "       0.45093333, 0.58942222, 0.55382222, 0.57244444, 0.45348889,\n",
      "       0.58873333, 0.71308395]), array([3086, 1362, 1817, 1525, 1885, 2460, 1686, 2211, 1742, 2041, 1134,\n",
      "          0]), array([10.68,  3.65,  6.37,  6.64,  6.65,  8.9 ,  4.72,  6.32,  7.49,\n",
      "        8.1 ,  3.3 ,  0.  ]), array([0.305987, 0.041791, 0.029488, 0.209435, 0.233037, 0.073088,\n",
      "       0.046142, 0.053721, 0.053868, 0.060813, 0.051143, 1.      ])], [array([0.80825595]), array([0.04424366]), array([0.80825595]), array([0.04424366]), array([0]), array([0]), array([1.])], [array([0.393972  , 0.41579263]), array([0.06904444, 0.04212024]), array([0.60758   , 0.41579263]), array([0.56726667, 0.04212024]), array([3700,    0]), array([15.51,  0.  ]), array([0.137332, 1.      ])], [array([0.22604   , 0.222602  , 0.22174   , 0.21659   , 0.23024   ,\n",
      "       0.223472  , 0.22257   , 0.223608  , 0.225776  , 0.21922   ,\n",
      "       0.225988  , 0.22452482]), array([0.37824444, 0.36809778, 0.36784444, 0.36080889, 0.38282222,\n",
      "       0.36949333, 0.37444444, 0.36101556, 0.38024667, 0.36326667,\n",
      "       0.37824667, 0.39829165]), array([0.5598    , 0.56158   , 0.57092   , 0.53168   , 0.50968   ,\n",
      "       0.551396  , 0.5472    , 0.5472    , 0.5104    , 0.551396  ,\n",
      "       0.54636   , 0.22452482]), array([0.53866667, 0.46704444, 0.58035556, 0.46093333, 0.55091111,\n",
      "       0.54643778, 0.54944444, 0.54944444, 0.68328889, 0.54643778,\n",
      "       0.56028889, 0.39829165]), array([2245, 2263, 2297, 1826, 2114, 2547, 2198, 2545, 2407, 3012, 2572,\n",
      "          0]), array([11.22, 11.63, 15.52, 11.02,  9.78, 13.56, 11.08, 11.04, 12.41,\n",
      "       11.08, 11.44,  0.  ]), array([0.179486, 0.047783, 0.114154, 0.068976, 0.033079, 0.183298,\n",
      "       0.222764, 0.060886, 0.045305, 0.284911, 0.044379, 1.      ])], [array([0.8047    , 0.844914  , 0.807714  , 0.850744  , 0.8018    ,\n",
      "       0.82576   , 0.85173   , 0.8041    , 0.802886  , 0.816976  ,\n",
      "       0.80442   , 0.82790867]), array([0.94121333, 0.95862222, 0.94604222, 0.90122444, 0.9278    ,\n",
      "       0.90622222, 0.91166889, 0.95884444, 0.93857778, 0.93544667,\n",
      "       0.95902222, 0.9371378 ]), array([0.39608   , 0.65934   , 0.5472    , 0.71528   , 0.57664   ,\n",
      "       0.54664   , 0.40552   , 0.5644    , 0.55638   , 0.56998   ,\n",
      "       0.5735    , 0.82790867]), array([0.4984    , 0.58542222, 0.54944444, 0.44124444, 0.51055556,\n",
      "       0.54853333, 0.5056    , 0.45093333, 0.56275556, 0.54366667,\n",
      "       0.54097778, 0.9371378 ]), array([3917, 2858, 4217, 4349, 2914, 3736, 3125, 2639, 2948, 5270, 3650,\n",
      "          0]), array([19.  , 12.16, 14.97, 15.42, 13.59, 14.25, 17.32, 13.1 , 13.19,\n",
      "       15.85, 14.56,  0.  ]), array([0.197305, 0.066278, 0.189939, 0.225541, 0.072539, 0.084258,\n",
      "       0.232211, 0.265667, 0.069417, 0.195143, 0.166994, 1.      ])], [array([0.51634   , 0.522164  , 0.50778   , 0.51608   , 0.553214  ,\n",
      "       0.5324    , 0.519898  , 0.50908   , 0.551016  , 0.5357    ,\n",
      "       0.54998   , 0.53288102]), array([0.41517778, 0.41013333, 0.408     , 0.415     , 0.40804222,\n",
      "       0.42069111, 0.40398667, 0.41744444, 0.42710889, 0.40493333,\n",
      "       0.43942222, 0.40247466]), array([0.58204   , 0.5548    , 0.60566   , 0.50698   , 0.35888   ,\n",
      "       0.62362   , 0.52008   , 0.513612  , 0.54448   , 0.47058   ,\n",
      "       0.58556   , 0.53288102]), array([0.51829778, 0.52046667, 0.45906667, 0.50370889, 0.47431111,\n",
      "       0.49791111, 0.48348889, 0.46503556, 0.48471111, 0.52597778,\n",
      "       0.55695556, 0.40247466]), array([1458, 2828, 1252, 1076, 1809, 1337, 1093,  634, 1124, 1593, 1099,\n",
      "          0]), array([3.87, 4.16, 3.01, 2.64, 5.38, 3.32, 2.3 , 1.81, 2.09, 4.17, 3.57,\n",
      "       0.  ]), array([0.030844, 0.017467, 0.03695 , 0.035514, 0.043593, 0.028714,\n",
      "       0.017472, 0.208692, 0.046636, 0.011129, 0.060486, 1.      ])], [array([0.94292   , 0.97993803]), array([0.43942222, 0.40263977]), array([0.62634   , 0.97993803]), array([0.4934    , 0.40263977]), array([2081,    0]), array([11.31,  0.  ]), array([0.054114, 1.      ])], [array([0.221122  , 0.25922624]), array([0.78451556, 0.81452487]), array([0.547828  , 0.25922624]), array([0.54594667, 0.81452487]), array([2581,    0]), array([13.87,  0.  ]), array([0.283618, 1.      ])], [array([0.6471    , 0.62198563]), array([0.29869778, 0.29475595]), array([0.60874   , 0.62198563]), array([0.48791111, 0.29475595]), array([2854,    0]), array([6.75, 0.  ]), array([0.029936, 1.      ])], [array([0.35614321]), array([0.94947447]), array([0.35614321]), array([0.94947447]), array([0]), array([0]), array([1.])], [array([0.0584    , 0.05606   , 0.054328  , 0.03615812]), array([0.80822   , 0.77548889, 0.81229111, 0.78772761]), array([0.551396  , 0.71528   , 0.6169    , 0.03615812]), array([0.54643778, 0.44124444, 0.46373333, 0.78772761]), array([3604, 4026, 4480,    0]), array([15.81, 23.14, 20.12,  0.  ]), array([0.169122, 0.284294, 0.147467, 1.      ])], [array([0.73729586]), array([0.10317523]), array([0.73729586]), array([0.10317523]), array([0]), array([0]), array([1.])], [array([0.12812   , 0.120536  , 0.135596  , 0.128058  , 0.13965611]), array([0.9438    , 0.94083111, 0.92544222, 0.94228222, 0.926348  ]), array([0.65066   , 0.52188   , 0.5796    , 0.48638   , 0.13965611]), array([0.48648889, 0.42364444, 0.53984444, 0.72613333, 0.926348  ]), array([3424, 5790, 3743, 3593,    0]), array([19.32, 22.53, 17.88, 13.01,  0.  ]), array([0.272012, 0.210388, 0.213717, 0.055128, 1.      ])], [array([0.05677904]), array([0.20082402]), array([0.05677904]), array([0.20082402]), array([0]), array([0]), array([1.])], [array([0.222144  , 0.21194   , 0.2334    , 0.1944    , 0.207236  ,\n",
      "       0.20118   , 0.181952  , 0.202748  , 0.1827    , 0.205748  ,\n",
      "       0.21896   , 0.20344274]), array([0.78653333, 0.79788889, 0.79044444, 0.76835556, 0.77212667,\n",
      "       0.76117778, 0.75886889, 0.79332   , 0.77849556, 0.77247111,\n",
      "       0.79377778, 0.77654082]), array([0.6188    , 0.48982   , 0.6085    , 0.50114   , 0.49426   ,\n",
      "       0.54954   , 0.49272   , 0.49884   , 0.5311    , 0.68848   ,\n",
      "       0.59226   , 0.20344274]), array([0.48788889, 0.5596    , 0.52424444, 0.53322222, 0.52851111,\n",
      "       0.46848889, 0.51886667, 0.48346667, 0.45371111, 0.49515556,\n",
      "       0.56237778, 0.77654082]), array([4027, 3840, 2725, 4632, 4189, 6371, 4309, 3295, 4511, 3787, 3417,\n",
      "          0]), array([15.4 , 11.37, 12.73, 12.52, 11.65, 16.16, 12.05, 11.99, 14.29,\n",
      "       18.83, 13.41,  0.  ]), array([0.106642, 0.053989, 0.07477 , 0.238568, 0.040365, 0.075445,\n",
      "       0.2391  , 0.058455, 0.082849, 0.166138, 0.057065, 1.      ])], [array([0.900484  , 0.8812    , 0.89774   , 0.899598  , 0.904104  ,\n",
      "       0.904104  , 0.9112    , 0.900852  , 0.904104  , 0.877278  ,\n",
      "       0.86282   , 0.88991362]), array([0.87963778, 0.85126667, 0.8808    , 0.84338889, 0.88244222,\n",
      "       0.88244222, 0.86088889, 0.87966   , 0.88244222, 0.88215556,\n",
      "       0.84148667, 0.86754822]), array([0.45444   , 0.6454    , 0.559662  , 0.421378  , 0.6288    ,\n",
      "       0.59604   , 0.564192  , 0.60358   , 0.3504    , 0.36858   ,\n",
      "       0.548782  , 0.88991362]), array([0.656     , 0.48873333, 0.4522    , 0.50019111, 0.51197778,\n",
      "       0.57064444, 0.54302444, 0.5202    , 0.50357778, 0.47266667,\n",
      "       0.48993556, 0.86754822]), array([2617, 2517, 2477, 3539, 2171, 1961, 2747, 1676, 2902, 2277, 3038,\n",
      "          0]), array([14.22, 11.56, 12.71, 17.93, 12.44,  7.19, 13.4 ,  8.22, 18.45,\n",
      "       15.54, 13.5 ,  0.  ]), array([0.063096, 0.041955, 0.259192, 0.178067, 0.046319, 0.051598,\n",
      "       0.056614, 0.04162 , 0.180633, 0.179601, 0.255873, 1.      ])], [array([0.93537   , 0.9243    , 0.915792  , 0.92734   , 0.897604  ,\n",
      "       0.926838  , 0.939398  , 0.90958   , 0.882112  , 0.90612   ,\n",
      "       0.931216  , 0.91117747]), array([0.23898889, 0.23357778, 0.21542222, 0.25602222, 0.24251111,\n",
      "       0.21795333, 0.24526444, 0.25088889, 0.24981556, 0.20515556,\n",
      "       0.21252667, 0.22571368]), array([0.56562   , 0.53334   , 0.56706   , 0.5472    , 0.55276   ,\n",
      "       0.480362  , 0.63468   , 0.6222    , 0.58922   , 0.43796   ,\n",
      "       0.61952   , 0.91117747]), array([0.47533333, 0.54431111, 0.68351111, 0.54944444, 0.49411111,\n",
      "       0.47331333, 0.65444444, 0.4626    , 0.50935556, 0.66844444,\n",
      "       0.49166667, 0.22571368]), array([3961, 2849, 2535, 2985, 4595, 5025, 3774, 3099, 3587, 3939, 3273,\n",
      "          0]), array([13.05, 17.72, 17.88, 17.22, 13.88, 16.81, 16.92,  9.94, 12.27,\n",
      "       27.62, 12.16,  0.  ]), array([0.076096, 0.148453, 0.227946, 0.203562, 0.182252, 0.141067,\n",
      "       0.178973, 0.041859, 0.224365, 0.18914 , 0.048796, 1.      ])], [array([0.95209474]), array([0.78056141]), array([0.95209474]), array([0.78056141]), array([0]), array([0]), array([1.])], [array([0.677802  , 0.68093   , 0.663566  , 0.682592  , 0.66332   ,\n",
      "       0.656256  , 0.64758   , 0.673976  , 0.65204   , 0.6406    ,\n",
      "       0.678656  , 0.67061634]), array([0.51131111, 0.50125778, 0.51577778, 0.51758444, 0.4856    ,\n",
      "       0.46005778, 0.50357778, 0.49215556, 0.49151111, 0.484     ,\n",
      "       0.49604889, 0.49405879]), array([0.63986   , 0.63196   , 0.62154   , 0.62406   , 0.630412  ,\n",
      "       0.65216   , 0.54792   , 0.6178    , 0.47176   , 0.73328   ,\n",
      "       0.60702   , 0.67061634]), array([0.51353333, 0.50631111, 0.45553333, 0.48553333, 0.48869333,\n",
      "       0.43755556, 0.46662222, 0.501     , 0.48833333, 0.58342222,\n",
      "       0.56451111, 0.49405879]), array([ 913,  759, 2593, 1724,  749,  742, 1284,  621, 2838, 1245,  902,\n",
      "          0]), array([1.93, 1.92, 3.34, 2.59, 1.87, 1.87, 3.02, 1.91, 6.21, 3.57, 2.82,\n",
      "       0.  ]), array([0.020729, 0.017248, 0.040818, 0.037232, 0.009103, 0.069117,\n",
      "       0.34625 , 0.010051, 0.022173, 0.058903, 0.205332, 1.      ])], [array([0.863714 , 0.8647112]), array([0.4308    , 0.43107837]), array([0.61552  , 0.8647112]), array([0.43982222, 0.43107837]), array([2828,    0]), array([7.4, 0. ]), array([0.014068, 1.      ])], [array([0.2097    , 0.21514   , 0.21572   , 0.20906   , 0.199926  ,\n",
      "       0.19326   , 0.215504  , 0.209246  , 0.2167    , 0.209754  ,\n",
      "       0.217568  , 0.18038643]), array([0.41708889, 0.41446667, 0.37775556, 0.40988889, 0.36401333,\n",
      "       0.3638    , 0.37294444, 0.41672   , 0.36033333, 0.41420222,\n",
      "       0.36197556, 0.39251091]), array([0.54806   , 0.5164    , 0.51206   , 0.54636   , 0.62804   ,\n",
      "       0.44758   , 0.24444   , 0.53992   , 0.54694   , 0.52198   ,\n",
      "       0.53334   , 0.18038643]), array([0.52511111, 0.60637778, 0.46306667, 0.56028889, 0.52526667,\n",
      "       0.70897778, 0.49812889, 0.45088889, 0.46573333, 0.45433333,\n",
      "       0.54431111, 0.39251091]), array([3506, 2475, 3119, 3466, 3930, 4505, 3597, 3398, 4186, 3157, 3249,\n",
      "          0]), array([11.87,  9.74,  8.93, 11.29, 15.6 , 15.31,  5.66,  9.94, 11.88,\n",
      "        9.41, 11.16,  0.  ]), array([0.211873, 0.056078, 0.046087, 0.232071, 0.071311, 0.096073,\n",
      "       0.048606, 0.054049, 0.212166, 0.046365, 0.052819, 1.      ])], [array([0.52240924]), array([0.97919694]), array([0.52240924]), array([0.97919694]), array([0]), array([0]), array([1.])], [array([0.82116881]), array([0.34638098]), array([0.82116881]), array([0.34638098]), array([0]), array([0]), array([1.])], [array([0.34129   , 0.379446  , 0.374274  , 0.35957872]), array([0.86545111, 0.87602889, 0.86842222, 0.88854528]), array([0.48436   , 0.52546   , 0.52118   , 0.35957872]), array([0.5318    , 0.13686667, 0.49748889, 0.88854528]), array([3125, 4288, 3478,    0]), array([10.21, 24.61, 11.75,  0.  ]), array([0.063614, 0.179833, 0.049627, 1.      ])], [array([0.62154   , 0.65588   , 0.629598  , 0.64388   , 0.6362    ,\n",
      "       0.651272  , 0.64786   , 0.6793    , 0.62158   , 0.67951   ,\n",
      "       0.638372  , 0.65971114]), array([0.45993333, 0.46391111, 0.46030889, 0.44646667, 0.46617778,\n",
      "       0.46203333, 0.46017778, 0.43984444, 0.46253333, 0.43343111,\n",
      "       0.45191778, 0.45570949]), array([0.45858   , 0.73328   , 0.5625    , 0.52386   , 0.58238   ,\n",
      "       0.65328   , 0.71436   , 0.65922   , 0.65688   , 0.5728    ,\n",
      "       0.60182   , 0.65971114]), array([0.35948889, 0.58342222, 0.47126667, 0.51462222, 0.44944444,\n",
      "       0.49688889, 0.42633333, 0.46564444, 0.41324444, 0.50282222,\n",
      "       0.51482222, 0.45570949]), array([3257, 1456, 1277, 1708,  803,  684, 1118, 1114,  821, 1740,  826,\n",
      "          0]), array([6.68, 4.24, 3.05, 4.95, 1.96, 1.85, 2.67, 1.87, 2.37, 4.2 , 2.36,\n",
      "       0.  ]), array([0.034425, 0.249651, 0.055372, 0.017657, 0.040182, 0.009771,\n",
      "       0.014977, 0.038586, 0.075409, 0.049028, 0.033759, 1.      ])], [array([0.01592468]), array([0.16184251]), array([0.01592468]), array([0.16184251]), array([0]), array([0]), array([1.])], [array([0.70846   , 0.69477805]), array([0.26826667, 0.244878  ]), array([0.49216   , 0.69477805]), array([0.5532  , 0.244878]), array([2982,    0]), array([12.1,  0. ]), array([0.157691, 1.      ])], [array([0.556204  , 0.56920922]), array([0.49898889, 0.47286445]), array([0.59566   , 0.56920922]), array([0.53888889, 0.47286445]), array([722,   0]), array([2., 0.]), array([0.031659, 1.      ])], [array([0.43823464]), array([0.04623107]), array([0.43823464]), array([0.04623107]), array([0]), array([0]), array([1.])], [array([0.1094505]), array([0.05156903]), array([0.1094505]), array([0.05156903]), array([0]), array([0]), array([1.])], [array([0.27685393]), array([0.06153155]), array([0.27685393]), array([0.06153155]), array([0]), array([0]), array([1.])], [array([0.8482    , 0.87845169]), array([0.6614   , 0.6899816]), array([0.52738   , 0.87845169]), array([0.58368889, 0.6899816 ]), array([2564,    0]), array([9.18, 0.  ]), array([0.074584, 1.      ])], [array([0.15847334]), array([0.75099091]), array([0.15847334]), array([0.75099091]), array([0]), array([0]), array([1.])], [array([0.507604  , 0.529378  , 0.53184   , 0.50936   , 0.4838    ,\n",
      "       0.48288   , 0.49638   , 0.48284   , 0.5178    , 0.48792   ,\n",
      "       0.50984   , 0.51651749]), array([0.54429111, 0.58079333, 0.56746667, 0.5642    , 0.58446667,\n",
      "       0.54468889, 0.54846667, 0.54468889, 0.59915556, 0.55753333,\n",
      "       0.54315556, 0.57898846]), array([0.457916  , 0.61638   , 0.63394   , 0.4632    , 0.47196   ,\n",
      "       0.47734   , 0.6876    , 0.4973    , 0.61078   , 0.58286   ,\n",
      "       0.4275    , 0.51651749]), array([0.51761556, 0.55475556, 0.3866    , 0.51415556, 0.77106667,\n",
      "       0.42855556, 0.63837778, 0.51877556, 0.59746667, 0.38295556,\n",
      "       0.58126667, 0.57898846]), array([ 926,  524, 3444,  795, 2216, 1323, 1445,  825,  768, 2006, 1202,\n",
      "          0]), array([1.95, 2.13, 7.36, 2.14, 5.54, 3.18, 4.41, 1.84, 2.13, 6.03, 2.55,\n",
      "       0.  ]), array([0.059395, 0.01721 , 0.018758, 0.021407, 0.039605, 0.063207,\n",
      "       0.076364, 0.071235, 0.029142, 0.05255 , 0.064767, 1.      ])], [array([0.543402 , 0.5635747]), array([0.13393111, 0.1029399 ]), array([0.59188  , 0.5635747]), array([0.47151111, 0.1029399 ]), array([1721,    0]), array([10.69,  0.  ]), array([0.362123, 1.      ])], [array([0.410314  , 0.39904473]), array([0.71813556, 0.72611157]), array([0.583062  , 0.39904473]), array([0.53675333, 0.72611157]), array([2456,    0]), array([7.02, 0.  ]), array([0.018729, 1.      ])], [array([0.995406  , 0.99524   , 0.993804  , 0.993888  , 0.994696  ,\n",
      "       0.9944    , 0.98705714]), array([0.52261111, 0.51944444, 0.51706667, 0.52104222, 0.52135556,\n",
      "       0.52173333, 0.52550716]), array([0.62026   , 0.65934   , 0.5564    , 0.5934    , 0.62312   ,\n",
      "       0.5208    , 0.98705714]), array([0.39757778, 0.58542222, 0.47975556, 0.44297778, 0.52637778,\n",
      "       0.691     , 0.52550716]), array([2315, 1547, 3777, 3122, 2727, 3445,    0]), array([11.14,  9.04, 13.66, 12.3 , 11.6 , 16.19,  0.  ]), array([0.025928, 0.020147, 0.040812, 0.106238, 0.024663, 0.118457,\n",
      "       1.      ])], [array([0.18296   , 0.186666  , 0.164526  , 0.19048   , 0.186788  ,\n",
      "       0.15      , 0.15994   , 0.188376  , 0.17779077]), array([0.52664444, 0.53206222, 0.5239    , 0.5342    , 0.52608667,\n",
      "       0.53228889, 0.52846667, 0.52811333, 0.54411763]), array([0.52004   , 0.56666   , 0.49672   , 0.53452   , 0.54      ,\n",
      "       0.56346   , 0.545584  , 0.52328   , 0.17779077]), array([0.69126667, 0.41631111, 0.50724444, 0.68717778, 0.51755556,\n",
      "       0.4626    , 0.44304667, 0.43922222, 0.54411763]), array([2206, 2639, 2695, 2333, 2108, 2548, 2375, 1681,    0]), array([14.76, 14.34, 11.58, 15.2 , 11.92, 13.05, 12.62, 10.76,  0.  ]), array([0.102522, 0.099885, 0.040231, 0.138261, 0.062588, 0.064892,\n",
      "       0.063071, 0.037041, 1.      ])]]\n",
      "([array([0.36524   , 0.55816   , 0.720888  , 0.80825595, 0.60758   ,\n",
      "       0.5598    , 0.82790867, 0.58204   , 0.62634   , 0.547828  ,\n",
      "       0.60874   , 0.35614321, 0.03615812, 0.73729586, 0.13965611,\n",
      "       0.05677904, 0.20344274, 0.88991362, 0.56562   , 0.95209474,\n",
      "       0.67061634, 0.61552   , 0.54806   , 0.52240924, 0.82116881,\n",
      "       0.35957872, 0.45858   , 0.01592468, 0.49216   , 0.59566   ,\n",
      "       0.43823464, 0.1094505 , 0.27685393, 0.52738   , 0.15847334,\n",
      "       0.457916  , 0.59188   , 0.583062  , 0.62026   , 0.52004   ]), array([0.33351111, 0.53824444, 0.71308395, 0.04424366, 0.56726667,\n",
      "       0.53866667, 0.9371378 , 0.51829778, 0.4934    , 0.54594667,\n",
      "       0.48791111, 0.94947447, 0.78772761, 0.10317523, 0.926348  ,\n",
      "       0.20082402, 0.77654082, 0.86754822, 0.47533333, 0.78056141,\n",
      "       0.49405879, 0.43982222, 0.52511111, 0.97919694, 0.34638098,\n",
      "       0.88854528, 0.35948889, 0.16184251, 0.5532    , 0.53888889,\n",
      "       0.04623107, 0.05156903, 0.06153155, 0.58368889, 0.75099091,\n",
      "       0.51761556, 0.47151111, 0.53675333, 0.39757778, 0.69126667]), array([13,  5, 20,  6,  8,  6, 15, 22,  3,  3, 16,  3, 17, 17, 15,  4, 19,\n",
      "       12,  7,  5, 16, 20, 15,  9,  5, 21,  8,  6, 21,  2,  6,  5,  3, 19,\n",
      "        4, 14,  2,  7, 13,  0]), array([-0.78160619,  2.25837493, -3.87692716, -3.87692716, -0.57016752,\n",
      "        1.05102896, -3.87692716, -0.17438387,  1.74817988,  1.71618693,\n",
      "       -0.92636264, -3.87692716, -3.87692716, -3.87692716, -3.87692716,\n",
      "       -3.87692716,  0.35797021, -3.87692716, -0.58489312, -3.87692716,\n",
      "       -0.99155191, -0.95338075, -1.18075925, -3.87692716, -3.87692716,\n",
      "       -3.87692716, -0.61073895, -3.87692716, -0.62001441,  1.5532726 ,\n",
      "       -3.87692716, -3.87692716, -3.87692716, -0.80327971, -3.87692716,\n",
      "       -1.15186237,  1.19826486, -0.42953714, -1.02969214,  1.9655251 ]), array([ 0.63616008,  6.18959618,  5.66504526,  4.69930887,  3.71686053,\n",
      "        5.53892231,  7.9619379 ,  5.35765457,  6.10825062,  6.01085091,\n",
      "        2.59126949,  7.72957039,  2.00262976,  2.14129043,  3.20204806,\n",
      "        2.34368968,  2.48546267,  8.41040802,  2.23244262, 11.44190025,\n",
      "        3.17602777,  2.5451405 ,  2.30126476,  5.37143135,  6.56425095,\n",
      "        5.74004602,  1.16392732,  1.41751325,  3.45048594,  6.7428236 ,\n",
      "        1.78310287,  2.17207432,  1.88536119,  2.49003482,  4.29991055,\n",
      "        1.73821306,  6.06411552,  2.55224252,  2.54394364,  7.22747564])], array([ 9.85, 17.55,  0.  ,  0.  , 15.51, 11.22,  0.  ,  3.87, 11.31,\n",
      "       13.87,  6.75,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,\n",
      "       13.05,  0.  ,  0.  ,  7.4 , 11.87,  0.  ,  0.  ,  0.  ,  6.68,\n",
      "        0.  , 12.1 ,  2.  ,  0.  ,  0.  ,  0.  ,  9.18,  0.  ,  1.95,\n",
      "       10.69,  7.02, 11.14, 14.76]), array([3960., 3272.,  600.,  600., 3700., 2245.,  600., 1458., 2081.,\n",
      "       2581., 2854.,  600.,  600.,  600.,  600.,  600.,  600.,  600.,\n",
      "       3961.,  600.,  600., 2828., 3506.,  600.,  600.,  600., 3257.,\n",
      "        600., 2982.,  722.,  600.,  600.,  600., 2564.,  600.,  926.,\n",
      "       1721., 2456., 2315., 2206.]), {'time': array([49631, 18652, 72689, 24612, 31709, 21752, 56534, 80487, 12310,\n",
      "       12248, 58730, 12453, 62067, 64472, 56246, 17291, 68520, 44653,\n",
      "       27738, 21432, 60553, 74497, 56254, 33152, 20871, 77900, 32228,\n",
      "       24591, 78125,  7733, 23387, 21193, 13641, 71901, 16147, 52255,\n",
      "        9582, 28517, 47547,  3157])})\n"
     ]
    }
   ],
   "source": [
    "print(ev.get_actions())\n",
    "print(ev.step([0] * len(ev.processes)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
